<!doctype html>
<html lang="zh-CN" th:replace="web-layout :: layout(~{::title}, ~{::style}, ~{}, ~{::script}, ~{::body}, 'user')"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <title>个人信息</title>
    <style>

    </style>
    <script>
        //响应数据
        function responseHandler(res) {
            return res.data
        }

        function beginTimeFormatter(value, row, index) {
            return formatDateTime(row.beginTime);
        }

        function endTimeFormatter(value, row, index) {
            return formatDateTime(row.endTime);
        }

        var $table = $('#table')

        function operateFormatter(value, row, index) {
            return [
                '<button type="button" class="btn btn-primary btn-xs startExamBtn">开始考试</button>',
            ].join('');
        }

        var openIndex = 0;
        window.operateEvents = {
            'click .startExamBtn': function (e, value, row, index) {
                openIndex = layer.open({
                    type: 2,
                    area: ['50%', '50%'],
                    scrollbar: false,
                    title: row.name + "---试卷列表",
                    content: '/web/user/exam/paper/list/' + row.id //这里content是一个URL，如果你不想让iframe出现滚动条，你还可以content: ['http://sentsin.com', 'no']
                });
            },
        }

        function startPaper(paper) {
            ajaxText("/web/user/exam/paper/info/" + paper.id, {}, function (html) {
                $("body").html(html);
            })
            //关闭
            layer.close(openIndex);
        }

        // $(document).ready(function(){
        //     var range = 0;             //距下边界长度/单位px
        //     var totalheight = 0;
        //     var main = $("#dataList");                     //主体元素
        //     $(window).scroll(function(){
        //         var srollPos = $(window).scrollTop();    //滚动条距顶部距离(页面超出窗口的高度)
        //         // console.log("滚动条到顶部的垂直高度: "+$(document).scrollTop());
        //         // console.log("页面的文档高度 ："+$(document).height());
        //         // console.log('浏览器的高度：'+$(window).height());
        //
        //         totalheight = parseFloat($(window).height()) + parseFloat(srollPos);
        //         if(($(document).height()-range) <= totalheight) {
        //             dataList()
        //         }
        //     });
        // });

        $("#loadMore").click(function () {
            dataList()
        })

        var main = $("#dataList");                     //主体元素
        function dataList() {
            $.post("/exam/child/list", {name: $("#name").val()}, function (result) {
                main.append(result);
            });
        }
    </script>
</head>
<body>
<form>
    <div class="form-group">
        <label>姓名</label>
        <input type="text" class="form-control" name="name" id="name" placeholder="请输入" th:value="${loginUser.name}">
    </div>
    <div class="form-group">
        <label>性别</label>
        <select class="form-control" name="gender">
            <option value="A" th:selected="${loginUser.gender}=='A'">外星人</option>
            <option value="B" th:selected="${loginUser.gender}=='B'">男</option>
            <option value="C" th:selected="${loginUser.gender}=='C'">女</option>
        </select>
    </div>
    <button type="button" class="btn btn-primary">提交</button>
</form>
</body>
</html>